package com.bcx.crm.spring.websocket;

import org.springframework.stereotype.Component;
import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.TextWebSocketHandler;

/**
 * @Author: ys
 * @Date:Create in 2018/5/7 15:25
 * @Description: 创建webSocket处理类
 */
@Component
public class WebSocketEndPoint extends TextWebSocketHandler {
    @Override
    protected void handleTextMessage(WebSocketSession session, TextMessage message) throws Exception {
        super.handleTextMessage(session, message);
        TextMessage returnMessage = new TextMessage(message.getPayload() + "received at server");
        session.sendMessage(returnMessage);
    }
}
